import request from "@/utils/request";
import type {
  GetRecommendBannerResponse,
  GetHotRecommendResponse,
  GetHotRecommendTagResponse,
  GetNewAlbumResponse,
  GetRankingListResponse,
  GetSingerListResponse,
} from "./model/recommendModel";

enum Api {
  getRecommendBannerUrl = "/banner",
  getHotRecommendUrl = "/personalized",
  getHotRecommendTagUrl = "/playlist/hot",
  getNewAlbumUrl = "/top/album",
  getRankingListUrl = "/playlist/detail",
  getSingerListUrl = "/top/artists",
}

/**
 * @description:获取轮播图接口
 * @return {*}
 */
export const getRecommendBannerApi = () => {
  return request.get<any, GetRecommendBannerResponse>(
    Api.getRecommendBannerUrl
  );
};

/**
 * @description:获取热门推荐接口
 * @return {*}
 */
export const getHotRecommendApi = () => {
  return request.get<any, GetHotRecommendResponse>(Api.getHotRecommendUrl);
};

/**
 * @description:获取热门推荐的标签
 * @return {*}
 */
export const getHotRecommendTagApi = () => {
  return request.get<any, GetHotRecommendTagResponse>(
    Api.getHotRecommendTagUrl
  );
};

/**
 * @description:获取新碟上架接口
 * @return {*}
 */
export const getNewAlbumApi = () => {
  return request.get<any, GetNewAlbumResponse>(Api.getNewAlbumUrl);
};

/**
 * @description: 获取榜单接口
 * @param {number} id
 * @return {*}
 */
export const getRankingListApi = (id: number) => {
  return request.get<any, GetRankingListResponse>(Api.getRankingListUrl, {
    params: {
      id,
    },
  });
};

/**
 * @description:获取歌手列表
 * @param {number} offset
 * @param {number} limit
 * @return {*}
 */
export const getSingerListApi = (offset: number, limit: number) => {
  return request.get<any, GetSingerListResponse>(Api.getSingerListUrl, {
    params: {
      offset,
      limit,
    },
  });
};
